<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <!-- Jquery from Google CDN --> 
<script src="js/utf8_decode.js"></script>
<script type="text/javascript" src="js/jquery.listselect.min.js"></script>

</head>

<body>
<script>
	
	$(document).ready(function(){
	
	//$("#invitations").listselect();
	
	var x = document.getElementById('invitations');	
	var option;

	
	$.getJSON('functions/get_friends.php',{}, 
		function(data) {
			for(var i in data)
			{
			  option=document.createElement("option");
			  option.text=html_entity_decode(data[i]['name']);
			  option.value=data[i]['id'];
			  x.add(option,x.options[null]);
			}
			$("#invitations").listselect();
	   });
	
	});
	
	
	
	
	//$('option:selected',selobj).each( function() { vals.push( this.value ) } );
</script>

<label for="select">Seleccione amigos a invitar<br />
</label>
<select name="invitations" size="10" multiple="multiple" id="invitations" onChange="refill();">
</select>
</body>
</html>
